

package com.hexinfo.dmpro.sparing.controller;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.hexinfo.dmpro.common.annotation.AnonymousAccess;
import org.springframework.http.ResponseEntity;
import com.hexinfo.dmpro.sparing.model.SyncFullAudit;
import com.hexinfo.dmpro.sparing.service.SyncFullAuditService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import org.springframework.web.bind.annotation.*;


/**
 * 全量稽核日志表（记录表）
 *
 * @author yemw
 * @date 2024-01-30 17:02:18
 */
@RestController
@AllArgsConstructor
@RequestMapping("/api/syncfullaudit" )
@Api(value = "syncfullaudit", tags = "全量稽核日志表（记录表）管理")
public class SyncFullAuditController {

    private final  SyncFullAuditService syncFullAuditService;

    /**
     * 分页查询
     * @param page 分页对象
     * @param syncFullAudit 全量稽核日志表（记录表）
     * WrapperEnhancer.like(syncFullAudit); //自动拼接存在值sql的方法
     * @return
     */
    @ApiOperation(value = "分页查询", notes = "分页查询")
    @GetMapping("/page" )
    @AnonymousAccess
    public ResponseEntity<Object> getSyncFullAuditPage(Page page, SyncFullAudit syncFullAudit) {
        return ResponseEntity.ok(syncFullAuditService.queryList(page,syncFullAudit));
    }


    /**
     * 通过id查询全量稽核日志表（记录表）
     * @param id id
     * @return R
     */
    @ApiOperation(value = "通过id查询", notes = "通过id查询")
    @GetMapping("/{id}" )
    public ResponseEntity<Object> getById(@PathVariable("id" ) String id) {
        return ResponseEntity.ok(syncFullAuditService.getById(id));
    }

    /**
     * 新增全量稽核日志表（记录表）
     * @param syncFullAudit 全量稽核日志表（记录表）
     * @return R
     */
    @ApiOperation(value = "新增全量稽核日志表（记录表）", notes = "新增全量稽核日志表（记录表）")
    @PostMapping
    public ResponseEntity<Object> save(@RequestBody SyncFullAudit syncFullAudit) {
        return ResponseEntity.ok(syncFullAuditService.save(syncFullAudit));
    }

    /**
     * 修改全量稽核日志表（记录表）
     * @param syncFullAudit 全量稽核日志表（记录表）
     * @return R
     */
    @ApiOperation(value = "修改全量稽核日志表（记录表）", notes = "修改全量稽核日志表（记录表）")
    @PutMapping
    public ResponseEntity<Object> updateById(@RequestBody SyncFullAudit syncFullAudit) {
        return ResponseEntity.ok(syncFullAuditService.updateById(syncFullAudit));
    }

    /**
     * 通过id删除全量稽核日志表（记录表）
     * @param id id
     * @return R
     */
    @ApiOperation(value = "通过id删除全量稽核日志表（记录表）", notes = "通过id删除全量稽核日志表（记录表）")
    @DeleteMapping("/{id}" )
    public ResponseEntity<Object> removeById(@PathVariable String id) {
        return ResponseEntity.ok(syncFullAuditService.removeById(id));
    }

}
